home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / network / manageme / tcpdump-.001 / tcpdump-~ / tcpdump-3.0.2-linux / tcpdump-3.0.2 / interface.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-15  |  5.5 KB  |  151 lines

  1. /*
  2.  * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994
  3.  *    The Regents of the University of California.  All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that: (1) source code distributions
  7.  * retain the above copyright notice and this paragraph in its entirety, (2)
  8.  * distributions including binary code include the above copyright notice and
  9.  * this paragraph in its entirety in the documentation or other materials
  10.  * provided with the distribution, and (3) all advertising materials mentioning
  11.  * features or use of this software display the following acknowledgement:
  12.  * ``This product includes software developed by the University of California,
  13.  * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
  14.  * the University nor the names of its contributors may be used to endorse
  15.  * or promote products derived from this software without specific prior
  16.  * written permission.
  17.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
  18.  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  19.  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  20.  *
  21.  * @(#) $Header: interface.h,v 1.66 94/06/14 20:21:37 leres Exp $ (LBL)
  22.  */
  23.  
  24. #ifdef __GNUC__
  25. #define inline __inline
  26. #ifndef __dead
  27. #define __dead volatile
  28. #endif
  29. #else
  30. #define inline
  31. #define __dead
  32. #endif
  33.  
  34. #include "os.h"            /* operating system stuff */
  35. #include "md.h"            /* machine dependent stuff */
  36.  
  37. #ifndef SIGRET
  38. #define SIGRET void        /* default */
  39. #endif
  40.  
  41. struct token {
  42.     int v;            /* value */
  43.     char *s;        /* string */
  44. };
  45.  
  46. extern int dflag;        /* print filter code */
  47. extern int eflag;        /* print ethernet header */
  48. extern int nflag;        /* leave addresses as numbers */
  49. extern int Nflag;        /* remove domains from printed host names */
  50. extern int qflag;        /* quick (shorter) output */
  51. extern int Sflag;        /* print raw TCP sequence numbers */
  52. extern int tflag;        /* print packet arrival time */
  53. extern int vflag;        /* verbose */
  54. extern int xflag;        /* print packet in hex */
  55.  
  56. extern char *program_name;    /* used to generate self-identifying messages */
  57.  
  58. extern int snaplen;
  59. /* global pointers to beginning and end of current packet (during printing) */
  60. extern const u_char *packetp;
  61. extern const u_char *snapend;
  62.  
  63. extern int fddipad;    /* alignment offset for FDDI headers, in bytes */
  64.  
  65. /* Eliminate some bogus warnings. */
  66. struct timeval;
  67.  
  68. typedef void (*printfunc)(u_char *, struct timeval *, int, int);
  69.  
  70. extern void ts_print(const struct timeval *);
  71. extern int clock_sigfigs(void);
  72. int gmt2local(void);
  73.  
  74. extern int fn_print(const u_char *, const u_char *);
  75. extern int fn_printn(const u_char *, u_int, const u_char *);
  76. extern const char *tok2str(const struct token *, const char *, int);
  77. extern char *dnaddr_string(u_short);
  78. extern char *savestr(const char *);
  79.  
  80. extern int initdevice(char *, int, int *);
  81. extern void wrapup(int);
  82.  
  83. extern __dead void error(char *, ...);
  84. extern void warning(char *, ...);
  85.  
  86. extern char *read_infile(char *);
  87. extern char *copy_argv(char **);
  88.  
  89. extern void usage(void);
  90. extern char *isonsap_string(const u_char *);
  91. extern char *llcsap_string(u_char);
  92. extern char *protoid_string(const u_char *);
  93. extern char *dnname_string(u_short);
  94. extern char *dnnum_string(u_short);
  95.  
  96. /* The printer routines. */
  97.  
  98. struct pcap_pkthdr;
  99.  
  100. extern void ether_if_print(u_char *, const struct pcap_pkthdr *,
  101.                const u_char *);
  102. extern void fddi_if_print(u_char *, const struct pcap_pkthdr *, const u_char*);
  103. extern void null_if_print(u_char *, const struct pcap_pkthdr *, const u_char*);
  104. extern void ppp_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
  105. extern void sl_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
  106.  
  107. extern void arp_print(const u_char *, int, int);
  108. extern void ip_print(const u_char *, int);
  109. extern void tcp_print(const u_char *, int, const u_char *);
  110. extern void udp_print(const u_char *, int, const u_char *);
  111. extern void icmp_print(const u_char *, const u_char *);
  112. extern void default_print(const u_char *, int);
  113. extern void default_print_unaligned(const u_char *, int);
  114.  
  115. extern void aarp_print(const u_char *, int);
  116. extern void atalk_print(const u_char *, int);
  117. extern void bootp_print(const u_char *, int, u_short, u_short);
  118. extern void decnet_print(const u_char *, int, int);
  119. extern void egp_print(const u_char *, int, const u_char *);
  120. extern int ether_encap_print(u_short, const u_char *, int, int);
  121. extern void ipx_print(const u_char *, int length);
  122. extern void isoclns_print(const u_char *, int, int,
  123.               const u_char *, const u_char *);
  124. extern int llc_print(const u_char *, int, int, const u_char *, const u_char *);
  125. extern void nfsreply_print(const u_char *, int, const u_char *);
  126. extern void nfsreq_print(const u_char *, int, const u_char *);
  127. extern void ns_print(const u_char *, int);
  128. extern void ntp_print(const u_char *, int);
  129. extern void ospf_print(const u_char *, int, const u_char *);
  130. extern void rip_print(const u_char *, int);
  131. extern void snmp_print(const u_char *, int);
  132. extern void sunrpcrequest_print(const u_char *, int, const u_char *);
  133. extern void tftp_print(const u_char *, int);
  134. extern void wb_print(const void *, int);
  135.  
  136. #define min(a,b) ((a)>(b)?(b):(a))
  137. #define max(a,b) ((b)>(a)?(b):(a))
  138.  
  139. /*
  140.  * The default snapshot length.  This value allows most printers to print
  141.  * useful information while keeping the amount of unwanted data down.
  142.  * In particular, it allows for an ethernet header, tcp/ip header, and
  143.  * 14 bytes of data (assuming no ip options).
  144.  */
  145. #define DEFAULT_SNAPLEN 68
  146.  
  147. #ifndef BIG_ENDIAN
  148. #define BIG_ENDIAN 4321
  149. #define LITTLE_ENDIAN 1234
  150. #endif
  151.